package Iterator_pattern.ex1;

/**
 * @author 申书航
 * @version 1.0
 * 客户端类，用于测试宝箱和物品迭代器
 */
public class Client {

    /**
     * 主方法，程序入口
     * @param args 命令行参数
     */
    public static void main(String[] args) {
        TreasureChest chest = new TreasureChest();
        ItemIterator iterator1 = chest.iterator(ItemType.ANY);
        while (iterator1.hasNext()){
            System.out.println(iterator1.next());
        }
        System.out.println("====================");
        ItemIterator iterator2 = chest.iterator(ItemType.WEAPON);
        while (iterator2.hasNext()){
            System.out.println(iterator2.next());
        }
    }
}
